package com.zzmcc.member;

import com.jfinal.plugin.activerecord.Page;
import com.zzmcc.base.BaseController;
import com.zzmcc.sys.model.Userinfo;
import util.ChristStringUtil;
import util.CommonUtil;
import util.ModelUtils;

import java.util.ArrayList;
import java.util.List;

public class MemberController extends BaseController {
    public void index(){
        render("index.html");

	}
	
	public void add(){
        String paraStr = getPara();
        setAttr("username",paraStr);
        setAttr("aaa",paraStr);
		render("add.html");
	}


	public void checkIsNotExist(){
		renderJson(checkIsNotExist("sys_userinfo", "username", getPara("userinfo.username")));
	}
	
	public void save(){
        Userinfo model = getModel(Userinfo.class, "userinfo");
        model.set("isSystem", false);
        model.set("inuse", 1);
        model.set("roleid", -1);
        model.set("id", CommonUtil.getUUID());
        ModelUtils.fillForSave(model);
        model.save();
        setAttr("operateStr", "核实信息登记成功，请联系管理员核实信息!");
        render("save.html");

	}


    public void update(){
       Userinfo model = getModel(Userinfo.class, "userinfo");
       ModelUtils.fillForUpdate(model);
       model.update();
       setAttr("userinfo",model);
       render("edit.html");
    }
	


}
